Skip to main content
Version: 1.0.16

COMMIT PREPARED

COMMIT PREPARED — Commit a transaction that was earlier prepared for two-phase commit

Synopsis

COMMIT PREPARED transaction_id

Description

COMMIT PREPARED commits a transaction that is in the prepared state.

Parameters

transaction_id

The transaction identifier of the transaction to be committed.

Notes

To commit a prepared transaction, you must be either the same user who originally executed the transaction or a superuser. However, you do not need to be in the same session that executed the transaction.

This command cannot be executed within a transaction block. The prepared transaction will be committed immediately.

The pg_prepared_xacts system view lists all currently available prepared transactions.

Examples

Commit the transaction identified by the transaction identifier foobar:

COMMIT PREPARED 'foobar';

See Also

PREPARE TRANSACTION, ROLLBACK PREPARED